package com.jumi.microservice.material.mapper;

import com.jumi.microservice.material.domain.JmMaterial;
import com.jumi.microservice.material.dto.JmAttrResponse;
import com.jumi.microservice.material.dto.JmAttrValResponse;
import com.jumi.microservice.material.dto.JmMaterialRequest;
import com.jumi.microservice.material.dto.JmMaterialResponse;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @author ssk
 * @create 2020/8/4 14:33
 **/
public interface JmMaterialMapper {

    int saveBatch(@Param("list") List<JmMaterialRequest> materials);

    int saveAttrValues(List<Map<String, Object>> list);

    String findMaxCodeByGoodsId(Long goodsId);

    Long findMaxIdByGoodsId(Long goodsId);

    int updateBatch(@Param("list") List<JmMaterialRequest> materials);

    void deleteBatch(List<Long> materialIds);

    void deleteLinks(List<Map<String, Object>> list);

    List<JmAttrResponse> findAttrs(@Param("list") List<Long> list);

    List<JmAttrValResponse> findAttrVals(Map<String, Object> params);

    int syncPrice(Map<String, Object> params);

    int syncPriceBatch(List<Map<String,Object>> list);

    /**
     * @Description: 根据物料materialId查询物料
     * @Param materialId
     * @Return {@link JmMaterialResponse}
     * @Throws
     * @Author Abel Yang
     * @Date 2020/8/24/024 15:47
    */
    JmMaterialResponse findById(@Param("materialId") Long materialId);

    List<JmMaterialResponse> findByGoodsId(Long goodsId);

	List<JmMaterialResponse> findByGoodsCode(String goodsCode);

    Integer findMaterialIdByMaterialCode(String materialCode);

	String fingSpecNameByMaterialCode(String materialCode);

	String findBarCodeByMaterialCode(String materialSkuCode);
}
